import { type ReactNode } from 'react'
import type { IfElseProps } from './data'
/**
 * @description: 组件ifelse判断
 * @param {IfElseProps} param
 * @return {*}
 */
const IfElseIf = ({ condition, ifTrue, ifFalse }: IfElseProps): ReactNode => {
  if (typeof condition === 'boolean') {
    if (condition) {
      return ifTrue
    } else {
      return ifFalse
    }
  } else if (condition instanceof Function) {
    return condition()
  } else {
    return <></>
  }
}
export default IfElseIf
